﻿Public Partial Class ListItem
    Inherits System.Web.UI.Page

    Protected Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click

        Dim au As New Auction
        Dim ship As New Shipping
        Dim auctionImages As New List(Of Image)

        au.ownerID = Membership.GetUser().ProviderUserKey
        au.title = TextBox1.Text
        au.subTitle = TextBox2.Text
        au.condition = DropDownList2.SelectedValue
        au.categoryID = DropDownList1.SelectedValue
        au.startingDate = System.DateTime.Now
        au.startingPrice = TextBox3.Text
        au.reserveAmount = TextBox4.Text
        au.dimensions = TextBox5.Text
        au.description = txtDescription.Text
        ship.Method = TextBox6.Text
        ship.Price = TextBox7.Text
        ship.DeliveryTime = TextBox8.Text
        ship.Restrictions = TextBox9.Text

        Dim img1 As New Image
        img1.image = Fileupload1.FileBytes

        Dim img2 As New Image
        img2.image = Fileupload2.FileBytes

        Dim img3 As New Image
        img3.image = Fileupload3.FileBytes

        auctionImages.Add(img1)
        auctionImages.Add(img2)
        auctionImages.Add(img3)

        Dim itemSave As New SaveItem
        itemSave.Save(au, ship, auctionImages)
        Response.Redirect("itemlisted.aspx")

    End Sub
End Class